import { Component } from '@angular/core';
import { NavController, NavParams } from 'ionic-angular';
import { Camera } from 'ionic-native';

/*
  Generated class for the Camera page.

  See http://ionicframework.com/docs/v2/components/#navigation for more info on
  Ionic pages and navigation.
*/
@Component({
  selector: 'page-camera',
  templateUrl: 'camera.html'
})
export class Cameras {

  public oimg:any="";

  constructor(public navCtrl: NavController, public navParams: NavParams) {

  }

  getCamera() {
      console.log(this);
      Camera.getPicture({
        quality: 25,
        //destinationType: Camera.DestinationType.DATA_URL,     //DATA_URL 返回64  FILE_URI返回URl
        destinationType: Camera.DestinationType.FILE_URI,
      }).then(
        (imageData) => {
        // var Image = 'data:image/jpeg;base64,' + imageData;
        var Image = imageData;
        console.log(Image);
        console.log(this);
        console.log(this.oimg);
        this.oimg=Image;


      }, (err) => {
        console.log("失败");
        // Handle error
      });

  }



}
